package com.nageoffer.shortlink.admin.controller;

import com.nageoffer.shortlink.admin.common.convention.result.Result;
import com.nageoffer.shortlink.admin.remote.ShortLinkActualRemoteService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: UtlTitleController
 * Package:
 * Description: URL标题控制层
 *
 * @Author:xiaohei
 * @Create 2024/6/10 17:24
 * Version 1.0
 */
@RestController(value = "utlTitleControllerByAdmin")
@RequiredArgsConstructor
public class UtlTitleController {

    private final ShortLinkActualRemoteService shortLinkActualRemoteService;
    /**
     * 根据URl获取对应网站的标题
     * @param url
     * @return
     */
    @GetMapping("/api/short-link/admin/v1/title")
    public Result<String> getTitleByUtl(@RequestParam("url") String url){
        return shortLinkActualRemoteService.getTitleByUtl(url);
    }

}
